package com.dmcb.trade.business.mappers;

import com.dmcb.trade.business.entities.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 文章爬虫Mapper
 * Created by long on 2015/3/21.
 */
public interface ArticleCrawlMapper {

    /**
     * 保存文章
     *
     * @param article
     */
    int insert(@Param("article") Article article);

    int insertAuthor(final @Param("author") Author author);

    /**
     * 保存文章内容
     *
     * @param body
     */
    int insertBody(final @Param("body") Body body);

    Article queryByLink(String link);

    Article queryByAuthorTitle(int authorId, String title);

    Author queryAuthor(int authorId);

//    @Update(value = "UPDATE t_author SET photoPath = #{1}, channelName = #{2} WHERE authorId = #{0}")
//    int updateAuthorInfo(int authorId, String photoPath, String channelName);

    void updateAuthorInfo(@Param("a") Author a);

    void updateAuthorLinkInfo(@Param("a") AuthorLink a);

    AuthorLink queryAuthorLink(String link);

    int countAuthorLink(String link);

    int countInvalidAuthorLink(String link);

    int insertAuthorLink(@Param("a") AuthorLink a);

    List<AuthorLink> queryForAuto(int size);

    List<AuthorLink> queryTouTiaoForAuto(int size);

    List<AuthorLink> queryTouTiaoForAuthorId(int id);

    List<Article> queryForCover(int size);

    int updateCoverPath(int id, String coverPath);

    int setAuthorLinkValid(String link);

    int updateLinkLastTime(String link);

    int setLinkValid(String link);

    AuthorLink queryForUpdate(int id);

    List<Article> queryAArticleByPT(int size);

    List<Article> queryForPostTime(int size);

    void updatePlatForm(@Param("article") Article article);

    void updatePostTime(@Param("article") Article article);

    List<Article> queryListByPTACT();

    List<MonitorArticle> queryByPirateUtl(int id);

    List<MonitorArticle> queryByPirateUtlBaidu(int id);
}
